package com.sicheng.蓝桥.国赛准备.output;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/2/5 15:15
 */
public class 格式化输出测试 {

    public static void main(String[] args) {

        double x = 3.14559;
        System.out.printf("%.2f%n", 2.565); //输出:2.57
        System.out.printf("%.2f%n", 2.575);//输出:2.58
        System.out.printf("%.2f%n", 2.564);//输出:2.56
        System.out.printf("%.2f%n", -2.565);//输出:-2.57
        System.out.printf("%.2f%n", -2.575);//输出:-2.58
        System.out.printf("%.2f%n", -2.564);//输出:-2.56
        System.out.printf("%.2f%n", x);
    }
}
